.class public Lnet/oauth/client/httpclient4/HttpMethodResponse;
.super Lnet/oauth/http/HttpResponseMessage;
.source "HttpMethodResponse.java"


# instance fields
.field private final httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

.field private final httpResponse:Lorg/apache/http/HttpResponse;

.field private final requestBody:[B

.field private final requestEncoding:Ljava/lang/String;


# direct methods
.method public constructor <init>(Lorg/apache/http/client/methods/HttpRequestBase;Lorg/apache/http/HttpResponse;[BLjava/lang/String;)V
    .locals 3
    .parameter "request"
    .parameter "response"
    .parameter "requestBody"
    .parameter "requestEncoding"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 53
    invoke-virtual {p1}, Lorg/apache/http/client/methods/HttpRequestBase;->getMethod()Ljava/lang/String;

    move-result-object v0

    new-instance v1, Ljava/net/URL;

    invoke-virtual {p1}, Lorg/apache/http/client/methods/HttpRequestBase;->getURI()Ljava/net/URI;

    move-result-object v2

    invoke-virtual {v2}, Ljava/net/URI;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-direct {p0, v0, v1}, Lnet/oauth/http/HttpResponseMessage;-><init>(Ljava/lang/String;Ljava/net/URL;)V

    .line 54
    iput-object p1, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    .line 55
    iput-object p2, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    .line 56
    iput-object p3, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->requestBody:[B

    .line 57
    iput-object p4, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->requestEncoding:Ljava/lang/String;

    .line 58
    iget-object v0, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->headers:Ljava/util/List;

    invoke-direct {p0}, Lnet/oauth/client/httpclient4/HttpMethodResponse;->getHeaders()Ljava/util/List;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 59
    return-void
.end method

.method private getHeaders()Ljava/util/List;
    .locals 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/util/Map$Entry",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;>;"
        }
    .end annotation

    .prologue
    .line 80
    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    .line 81
    .local v3, headers:Ljava/util/List;,"Ljava/util/List<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;>;"
    iget-object v6, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    invoke-interface {v6}, Lorg/apache/http/HttpResponse;->getAllHeaders()[Lorg/apache/http/Header;

    move-result-object v0

    .line 82
    .local v0, allHeaders:[Lorg/apache/http/Header;
    if-eqz v0, :cond_0

    .line 83
    move-object v1, v0

    .local v1, arr$:[Lorg/apache/http/Header;
    array-length v5, v1

    .local v5, len$:I
    const/4 v4, 0x0

    .local v4, i$:I
    :goto_0
    if-ge v4, v5, :cond_0

    aget-object v2, v1, v4

    .line 84
    .local v2, header:Lorg/apache/http/Header;
    new-instance v6, Lnet/oauth/OAuth$Parameter;

    invoke-interface {v2}, Lorg/apache/http/Header;->getName()Ljava/lang/String;

    move-result-object v7

    invoke-interface {v2}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v8

    invoke-direct {v6, v7, v8}, Lnet/oauth/OAuth$Parameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v3, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 83
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 87
    .end local v1           #arr$:[Lorg/apache/http/Header;
    .end local v2           #header:Lorg/apache/http/Header;
    .end local v4           #i$:I
    .end local v5           #len$:I
    :cond_0
    return-object v3
.end method


# virtual methods
.method public dump(Ljava/util/Map;)V
    .locals 16
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 94
    .local p1, into:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    invoke-super/range {p0 .. p1}, Lnet/oauth/http/HttpResponseMessage;->dump(Ljava/util/Map;)V

    .line 96
    new-instance v10, Ljava/lang/StringBuilder;

    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    invoke-virtual {v13}, Lorg/apache/http/client/methods/HttpRequestBase;->getMethod()Ljava/lang/String;

    move-result-object v13

    invoke-direct {v10, v13}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 97
    .local v10, request:Ljava/lang/StringBuilder;
    const-string v13, " "

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    move-object/from16 v0, p0

    iget-object v14, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    invoke-virtual {v14}, Lorg/apache/http/client/methods/HttpRequestBase;->getURI()Ljava/net/URI;

    move-result-object v14

    invoke-virtual {v14}, Ljava/net/URI;->getPath()Ljava/lang/String;

    move-result-object v14

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 98
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    invoke-virtual {v13}, Lorg/apache/http/client/methods/HttpRequestBase;->getURI()Ljava/net/URI;

    move-result-object v13

    invoke-virtual {v13}, Ljava/net/URI;->getQuery()Ljava/lang/String;

    move-result-object v8

    .line 99
    .local v8, query:Ljava/lang/String;
    if-eqz v8, :cond_0

    invoke-virtual {v8}, Ljava/lang/String;->length()I

    move-result v13

    if-lez v13, :cond_0

    .line 100
    const-string v13, "?"

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 102
    :cond_0
    const-string v13, "\r\n"

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 103
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    invoke-virtual {v13}, Lorg/apache/http/client/methods/HttpRequestBase;->getAllHeaders()[Lorg/apache/http/Header;

    move-result-object v1

    .local v1, arr$:[Lorg/apache/http/Header;
    array-length v6, v1

    .local v6, len$:I
    const/4 v5, 0x0

    .local v5, i$:I
    :goto_0
    if-ge v5, v6, :cond_1

    aget-object v4, v1, v5

    .line 104
    .local v4, header:Lorg/apache/http/Header;
    invoke-interface {v4}, Lorg/apache/http/Header;->getName()Ljava/lang/String;

    move-result-object v13

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, ": "

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-interface {v4}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v14

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, "\r\n"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 103
    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    .line 106
    .end local v4           #header:Lorg/apache/http/Header;
    :cond_1
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    instance-of v13, v13, Lorg/apache/http/HttpEntityEnclosingRequest;

    if-eqz v13, :cond_2

    .line 107
    move-object/from16 v0, p0

    iget-object v9, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpRequest:Lorg/apache/http/client/methods/HttpRequestBase;

    check-cast v9, Lorg/apache/http/HttpEntityEnclosingRequest;

    .line 108
    .local v9, r:Lorg/apache/http/HttpEntityEnclosingRequest;
    invoke-interface {v9}, Lorg/apache/http/HttpEntityEnclosingRequest;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v13

    invoke-interface {v13}, Lorg/apache/http/HttpEntity;->getContentLength()J

    move-result-wide v2

    .line 109
    .local v2, contentLength:J
    const-wide/16 v13, 0x0

    cmp-long v13, v2, v13

    if-ltz v13, :cond_2

    .line 110
    const-string v13, "Content-Length: "

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, "\r\n"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 113
    .end local v2           #contentLength:J
    .end local v9           #r:Lorg/apache/http/HttpEntityEnclosingRequest;
    :cond_2
    const-string v13, "\r\n"

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 114
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->requestBody:[B

    if-eqz v13, :cond_3

    .line 115
    new-instance v13, Ljava/lang/String;

    move-object/from16 v0, p0

    iget-object v14, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->requestBody:[B

    move-object/from16 v0, p0

    iget-object v15, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->requestEncoding:Ljava/lang/String;

    invoke-direct {v13, v14, v15}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    invoke-virtual {v10, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 117
    :cond_3
    const-string v13, "HTTP request"

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v14

    move-object/from16 v0, p1

    invoke-interface {v0, v13, v14}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 120
    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    .line 121
    .local v11, response:Ljava/lang/StringBuilder;
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    invoke-interface {v13}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v12

    .line 122
    .local v12, value:Ljava/lang/String;
    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, "\r\n"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 123
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    invoke-interface {v13}, Lorg/apache/http/HttpResponse;->getAllHeaders()[Lorg/apache/http/Header;

    move-result-object v1

    array-length v6, v1

    const/4 v5, 0x0

    :goto_1
    if-ge v5, v6, :cond_4

    aget-object v4, v1, v5

    .line 124
    .restart local v4       #header:Lorg/apache/http/Header;
    invoke-interface {v4}, Lorg/apache/http/Header;->getName()Ljava/lang/String;

    move-result-object v7

    .line 125
    .local v7, name:Ljava/lang/String;
    invoke-interface {v4}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v12

    .line 126
    invoke-virtual {v11, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, ": "

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string v14, "\r\n"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 123
    add-int/lit8 v5, v5, 0x1

    goto :goto_1

    .line 128
    .end local v4           #header:Lorg/apache/http/Header;
    .end local v7           #name:Ljava/lang/String;
    :cond_4
    const-string v13, "\r\n"

    invoke-virtual {v11, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 129
    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->body:Ljava/io/InputStream;

    if-eqz v13, :cond_5

    .line 130
    new-instance v14, Ljava/lang/String;

    move-object/from16 v0, p0

    iget-object v13, v0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->body:Ljava/io/InputStream;

    check-cast v13, Lnet/oauth/client/ExcerptInputStream;

    invoke-virtual {v13}, Lnet/oauth/client/ExcerptInputStream;->getExcerpt()[B

    move-result-object v13

    invoke-virtual/range {p0 .. p0}, Lnet/oauth/client/httpclient4/HttpMethodResponse;->getContentCharset()Ljava/lang/String;

    move-result-object v15

    invoke-direct {v14, v13, v15}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    invoke-virtual {v11, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 133
    :cond_5
    const-string v13, "HTTP response"

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v14

    move-object/from16 v0, p1

    invoke-interface {v0, v13, v14}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 135
    return-void
.end method

.method public getStatusCode()I
    .locals 1

    .prologue
    .line 69
    iget-object v0, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v0

    invoke-interface {v0}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v0

    return v0
.end method

.method public openBody()Ljava/io/InputStream;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 75
    iget-object v0, p0, Lnet/oauth/client/httpclient4/HttpMethodResponse;->httpResponse:Lorg/apache/http/HttpResponse;

    invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v0

    invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v0

    return-object v0
.end method
